'\" t
.\"     Title: last
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.15
.\"      Date: 2021-06-02
.\"    Manual: User Commands
.\"    Source: util-linux 2.37.2
.\"  Language: English
.\"
.TH "LAST" "1" "2021-06-02" "util\-linux 2.37.2" "User Commands"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
last, lastb \- show a listing of last logged in users
.SH "SYNOPSIS"
.sp
\fBlast\fP [options] [\fIusername\fP...] [\fItty\fP...]
.sp
\fBlastb\fP [options] [\fIusername\fP...] [\fItty\fP...]
.SH "DESCRIPTION"
.sp
\fBlast\fP searches back through the \fI/var/log/wtmp\fP file (or the file designated by the \fB\-f\fP option) and displays a list of all users logged in (and out) since that file was created. One or more \fIusernames\fP and/or \fIttys\fP can be given, in which case \fBlast\fP will show only the entries matching those arguments. Names of \fIttys\fP can be abbreviated, thus \fBlast 0\fP is the same as \fBlast tty0\fP.
.sp
When catching a \fBSIGINT\fP signal (generated by the interrupt key, usually control\-C) or a SIGQUIT signal, \fBlast\fP will show how far it has searched through the file; in the case of the \fBSIGINT\fP signal \fBlast\fP will then terminate.
.sp
The pseudo user \fBreboot\fP logs in each time the system is rebooted. Thus \fBlast reboot\fP will show a log of all the reboots since the log file was created.
.sp
\fBlastb\fP is the same as \fBlast\fP, except that by default it shows a log of the \fI/var/log/btmp\fP file, which contains all the bad login attempts.
.SH "OPTIONS"
.sp
\fB\-a\fP, \fB\-\-hostlast\fP
.RS 4
Display the hostname in the last column. Useful in combination with the \fB\-\-dns\fP option.
.RE
.sp
\fB\-d\fP, \fB\-\-dns\fP
.RS 4
For non\-local logins, Linux stores not only the host name of the remote host, but its IP number as well. This option translates the IP number back into a hostname.
.RE
.sp
\fB\-f\fP, \fB\-\-file\fP \fIfile\fP
.RS 4
Tell \fBlast\fP to use a specific \fIfile\fP instead of \fI/var/log/wtmp\fP. The \fB\-\-file\fP option can be given multiple times, and all of the specified files will be processed.
.RE
.sp
\fB\-F\fP, \fB\-\-fulltimes\fP
.RS 4
Print full login and logout times and dates.
.RE
.sp
\fB\-i\fP, \fB\-\-ip\fP
.RS 4
Like \fB\-\-dns ,\fP but displays the host\(cqs IP number instead of the name.
.RE
.sp
\fB\-\fP\fInumber\fP; \fB\-n\fP, \fB\-\-limit\fP \fInumber\fP
.RS 4
Tell \fBlast\fP how many lines to show.
.RE
.sp
\fB\-p\fP, \fB\-\-present\fP \fItime\fP
.RS 4
Display the users who were present at the specified time. This is like using the options \fB\-\-since\fP and \fB\-\-until\fP together with the same \fItime\fP.
.RE
.sp
\fB\-R\fP, \fB\-\-nohostname\fP
.RS 4
Suppresses the display of the hostname field.
.RE
.sp
\fB\-s\fP, \fB\-\-since\fP \fItime\fP
.RS 4
Display the state of logins since the specified \fItime\fP. This is useful, e.g., to easily determine who was logged in at a particular time. The option is often combined with \fB\-\-until\fP.
.RE
.sp
\fB\-t\fP, \fB\-\-until\fP \fItime\fP
.RS 4
Display the state of logins until the specified \fItime\fP.
.RE
.sp
\fB\-\-time\-format\fP \fIformat\fP
.RS 4
Define the output timestamp \fIformat\fP to be one of \fInotime\fP, \fIshort\fP, \fIfull\fP, or \fIiso\fP. The \fInotime\fP variant will not print any timestamps at all, \fIshort\fP is the default, and \fIfull\fP is the same as the \fB\-\-fulltimes\fP option. The \fIiso\fP variant will display the timestamp in ISO\-8601 format. The ISO format contains timezone information, making it preferable when printouts are investigated outside of the system.
.RE
.sp
\fB\-w\fP, \fB\-\-fullnames\fP
.RS 4
Display full user names and domain names in the output.
.RE
.sp
\fB\-x\fP, \fB\-\-system\fP
.RS 4
Display the system shutdown entries and run level changes.
.RE
.SH "TIME FORMATS"
.sp
The options that take the \fItime\fP argument understand the following formats:
.TS
allbox tab(:);
lt lt.
T{
.sp
YYYYMMDDhhmmss
T}:T{
.sp

T}
T{
.sp
YYYY\-MM\-DD hh:mm:ss
T}:T{
.sp

T}
T{
.sp
YYYY\-MM\-DD hh:mm
T}:T{
.sp
(seconds will be set to 00)
T}
T{
.sp
YYYY\-MM\-DD
T}:T{
.sp
(time will be set to 00:00:00)
T}
T{
.sp
hh:mm:ss
T}:T{
.sp
(date will be set to today)
T}
T{
.sp
hh:mm
T}:T{
.sp
(date will be set to today, seconds to 00)
T}
T{
.sp
now
T}:T{
.sp

T}
T{
.sp
yesterday
T}:T{
.sp
(time is set to 00:00:00)
T}
T{
.sp
today
T}:T{
.sp
(time is set to 00:00:00)
T}
T{
.sp
tomorrow
T}:T{
.sp
(time is set to 00:00:00)
T}
T{
.sp
+5min
T}:T{
.sp

T}
T{
.sp
\-5days
T}:T{
.sp

T}
.TE
.sp
.SH "FILES"
.sp
\fI/var/log/wtmp\fP,
\fI/var/log/btmp\fP
.SH "NOTES"
.sp
The files \fIwtmp\fP and \fIbtmp\fP might not be found. The system only logs information in these files if they are present. This is a local configuration issue. If you want the files to be used, they can be created with a simple \fBtouch\fP(1) command (for example, \fBtouch /var/log/wtmp\fP).
.SH "AUTHORS"
.sp
.MTO "miquels\(atcistron.nl" "Miquel van Smoorenburg" ""
.SH "SEE ALSO"
.sp
\fBlogin\fP(1),
\fBwtmp\fP(5),
\fBinit\fP(8),
\fBshutdown\fP(8)
.SH "REPORTING BUGS"
.sp
For bug reports, use the issue tracker at \c
.URL "https://github.com/karelzak/util\-linux/issues" "" "."
.SH "AVAILABILITY"
.sp
The \fBlast\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."